package com.zego.wawaji.ui.play;

import android.content.Context;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.zego.wawaji.R;
import com.zego.wawaji.third.image.ImageLoader;
import com.zego.wawaji.ui.base.ExBaseAdapter;
import com.zego.wawaji.wawaji_client.App;

import java.util.List;

/**
 * 预约头像队列
 * Created by Su on 2017/12/10.
 */
public class HoriQueueAdapter extends ExBaseAdapter<String> {

    public HoriQueueAdapter(Context context, List<String> datas) {
        super(context, datas);
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder mHolder;
        if (convertView == null) {
            mHolder = new ViewHolder();
            convertView = inflate(R.layout.queue_list_item);
            mHolder.head = (ImageView) convertView.findViewById(R.id.queue_head);
            convertView.setTag(mHolder);
        } else {
            mHolder = (ViewHolder) convertView.getTag();
        }

        String url = getItem(position);
        if (!TextUtils.isEmpty(url)) {
            ImageLoader.loadCircleAvatar(App.getContext(), url, mHolder.head);
        }
        return convertView;
    }

    @Override
    public int getCount() {
        return super.getCount();
    }

    private class ViewHolder {
        ImageView head;
    }
}
